import {SingerclassificationList,Getsingerdetails,Getthesingeralbum,Getsingermvlist,Getthesingerdescription,
  GetasimilarsingerList
} from '@/api/api'
const state={
  //歌手分类列表
  artists:[],
  //获取歌手详情
  singerlist:{},
  hotSongs:[],
 //获取歌手专辑
 hotAlbums:[],
 //获取歌手mv
 mvs:[],
 //获取歌手详情
 datalist:[],
//获取相似歌手
artists:[]
};
const mutations={
//歌手分类列表
SINGERCLASSIFICATIONLIST(state,artists){
  state.artists = artists
},
 //获取歌手详情
GETSINGERDETAILS(state,singerlist){
  state.singerlist = singerlist
},
HOTSONGS(state,hotSongs){
  state.hotSongs = hotSongs
},
 //获取歌手专辑
 GETTHESINGERDETAILS(state,hotAlbums){
  state.hotAlbums = hotAlbums
 },
 //获取歌手MV
 SINGERMVLIST(state,mvs){
  state.mvs = mvs
 },
 //获取歌手详情
 THESINGERDESCRIPTTION(state,datalist){
  state.datalist = datalist
 },
 //获取相似歌手
 ASIMILARSINGERLIST(state,artists){
  state.artists = artists
 }
};
const actions={
 //歌手分类列表
 async getSingerclassificationList({commit},{limit,type,area,initial}){
  let request = await SingerclassificationList({limit,type,area,initial})
  if(request.data.code==200){
    commit('SINGERCLASSIFICATIONLIST',request.data.artists)
  }
 },
 //获取歌手详情
async getGetsingerdetails({commit},{id}){
let request = await Getsingerdetails(id)
if(request.data.code==200){
  commit('GETSINGERDETAILS',request.data)
  commit('HOTSONGS',request.data.hotSongs)
}

 },
 //获取歌手专辑
 async getGetthesingeralbum({commit},{id,limit}){
 let request = await Getthesingeralbum({id,limit})
 if(request.data.code==200){
  commit('GETTHESINGERDETAILS',request.data.hotAlbums)
 }
 },
 //获取歌手MV
 async getGetsingermvlist({commit},{id,limit}){
    let request = await Getsingermvlist({id,limit})
    if(request.data.code==200){
      commit('SINGERMVLIST',request.data.mvs)
    }
 },
 //获取歌手详情
 async getGetthesingerdescription({commit},{id}){
  let request = await Getthesingerdescription(id)
  if(request.data.code==200){
    commit('THESINGERDESCRIPTTION',request.data)
  }
 },
 //获取相似歌手
 async getGetasimilarsingerList({commit},{id}){
 let request = await GetasimilarsingerList(id)
 if(request.data.code==200){
  commit('ASIMILARSINGERLIST',request.data.artists)
 }
 console.log(request);
 }
};
const getter={

};
export default {
  state,
  mutations,
  actions,
  getter
}